<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
    <base href="<%=basePath%>">
    <title>优标检测网</title>
    <!-- 浏览器上显示title 图标 icon图标 -->
	<link type="image/x-icon" rel="icon" href="<%=basePath %>resource/img/minilogo.png">

	<!-- 如果想让图标出现在收藏夹中，就：  -->
	<link type="image/x-icon" rel="shortcut icon" href="<%=basePath %>resource/img/minilogo.png">
	<link type="image/x-icon" rel="bookmark" href="<%=basePath %>resource/img/minilogo.png">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="优标">
	<meta http-equiv="description" content="优标">
    <link href="<%=basePath %>portal/css/main.css" type="text/css" rel="stylesheet">
    <link href="<%=basePath %>portal/css/datepickerbootstrap.css" type="text/css" rel="stylesheet">
    <title>用户注册</title>
</head>
<body>

<%@include file="p_head.jsp"%>

<div class="NCContent">
    <div class="NCNewsHead">
        <div class="MainPage">
            <div class="NCMain">
                <h2 class="NCHeadWord">个人中心 / Personal Center</h2>
            </div>
        </div>
    </div>
    <div class="NCNewsList">
        <div class="MainPage">
            <div class="NCMain">
                <div class="NCNewsListContent">
                    <div class="QCTitleContentHead">用户注册</div>
                    <a href="javascript:history.back()" class="SCBackBtn">返回</a>
                    <div class="QCCreateBody">
                        <div class="RegisterContent">
                            <div class="RegStepBox">
                                <div class="RegStep">
                                    第一步<br/>
                                    选择账户类型
                                </div>
                                <div class="RegStep">
                                    第二部<br/>
                                    填写注册信息
                                </div>
                                <div class="RegStep RegStepAct">
                                    第三步<br/>
                                    注册完成
                                </div>
                            </div>
                        </div>
                        <div class="RegPhoneTest">
                        	<form action="<%=basePath%>reg_person.action" method="post" id="regPersonForm">
							<input type="hidden" name="accountType" id="accountType" value="${accountType}" />
                            <div class="RegPhoneTestBox">
                                <span class="RegPTTitle">手机号</span>
                                <span class="RegPTContent"><input class="RegPTCTextS" type="text" id="mobile" name="mobile"/>
                                <span style="display:none;" class="RegMsg">*手机号格式不正确</span></span>
                            </div>
                            <div class="RegPhoneTestBox">
                                <span class="RegPTTitle">验证码</span>
                                <span class="RegPTContent"><input class="RegPTCTextNS" type="text" id="checkcode" name="checkcode"/><input type="button"
                                                                                                           class="BtnCss RegPhoneBtn" value="发送验证码">
								<span style="display:none;" class="RegMsg">*验证码不能为空</span></span>
                            </div>
                            <div class="RegPhoneTestBox">
                                <span class="RegPTTitle">登录密码</span>
                                <span class="RegPTContent"><input class="RegPTCTextS" type="password" id="loginpwd" name="loginpwd"/>
                                <span style="display:none;" class="RegMsg">*密码不能为空</span></span>
                            </div>
                            <div class="RegPhoneTestBox">
                                <span class="RegPTTitle">确认密码</span>
                                <span class="RegPTContent"><input class="RegPTCTextS" type="password" id="loginpwd2" name="loginpwd2"/>
                                <span style="display:none;" class="RegMsg">*两次密码不符</span></span>
                            </div>
                        </div>
                        <div class="QCCSubmitBox">
                            <span class="BtnCss QCCSubmitBtn">下一步</span>
                        </div>
                        </form>
                        <div style="clear:both"></div>
                    </div>
                    <div class="NCNewsListContentFoot"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@include file="p_foot.jsp"%>
</body>
<script src="<%=basePath %>portal/js/res/jquery-1.4.2.min.js"></script>
<script src="<%=basePath %>portal/js/res/responsiveslides.min.js"></script>
<script src="<%=basePath %>portal/js/res/zebra_datepicker.src.js"></script>
<script src="<%=basePath %>portal/js/page/base.js"></script>
<script src="<%=basePath %>portal/js/page/register.js"></script>
<script src="<%=basePath %>admin/assets/jquery-easyui-1.4.3/jquery.min.js"></script>
<script src="<%=basePath %>admin/assets/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
<script src="<%=basePath %>admin/assets/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>
<script>
    $(".RegPhoneBtn").click(function(){
		if (!checkmobile())
			return false;
		
    	$.ajax({
    		  cache: true,
              type: "GET",
              url:"<%=basePath%>reg_sendsms.action?mobile=" + $("#mobile").val(),
              async: false,
              error: function(request) {
                  alert("Connection error");
              },
              success: function(data) {
					switch(data.errcode) {
					case 0:
						sendsms();
						break;
					case 1:
						$("#mobile").parent().find(".RegMsg").html(data.errmsg).show();
						break;
					}
			}
		});
    })

	function sendsms() {
		var time = 60;
            var inta = setInterval(function( ){
                if(time != 0)
                {
                    $(".RegPhoneBtn").val(time + "秒后重新发送")
                    $(".RegPhoneBtn").attr("disabled",true)
                    $(".RegPhoneBtn").addClass("RegPhoneBtnDis");
                    time = time - 1;
                }
                else
                {
                    $(".RegPhoneBtn").val("发送验证码");
                    $(".RegPhoneBtn").attr("disabled",false);
                    $(".RegPhoneBtn").removeClass("RegPhoneBtnDis");
                    time = 60;
                    window.clearInterval(inta);
                }
            },1000)
	}
	
    $('#regPersonForm').form({
    onSubmit: function() {
        return $(this).form('validate');
    },
    success: function(data) {
		var mydata = JSON.parse(data);
		switch(mydata.result) {
		case 0:
			window.location="<%=basePath%>reg_step4.action";
			break;
		case 1:
		case 2:
		case 6:
			$("#mobile").parent().find(".RegMsg").html(mydata.msg).show();
			break;
		case 3:
			$("#loginpwd").parent().find(".RegMsg").html(mydata.msg).show();
			break;
		case 4:
			$("#loginpwd2").parent().find(".RegMsg").html(mydata.msg).show();
			break;
		case 5:
			$("#checkcode").parent().find(".RegMsg").html(mydata.msg).show();
			break;
		}
	}
});
$(".QCCSubmitBtn").click(function(){
	var flag = true;
	flag = checkmobile();
	flag = checkpassword2();
	if (flag)
		$('#regPersonForm').submit();
});
</script>
</html>